<?php

namespace app\admin\controller;

use app\model\RegionDao;
use think\admin\Controller;

class Region extends Controller
{
    protected $table = '';

    protected function initialize()
    {
        $this->table = RegionDao::query();
    }

    /**
     * 协会动态
     * @auth true
     * @menu true
     */
    public function index()
    {
        $this->title = '地区管理';
        $this->_query($this->table)
            ->like('title')
            ->order('sort desc,id DESC')
            ->dateBetween('create_at')
            ->page();
    }

    protected function _page_filter(&$list)
    {
    }

    /**
     * 添加
     * @auth true
     */
    public function add()
    {
        $this->_form($this->table, 'form');
    }

    /**
     * 编辑系
     * @auth true
     */
    public function edit()
    {
        $this->_form($this->table, 'form');
    }



    protected function _form_filter(&$data)
    {

    }

    protected function _form_result(&$result, &$data)
    {
        //if ($result) {
        //    jumpUrl(1, '保存成功', '/admin.html#/admin/news/index.html?spm=m-12-17');
        //} else {
        //    $this->error('保存失败');
        //}

    }

    /**
     * @auth true
     */
    public function remove()
    {
        $this->_applyFormToken();
        $this->_delete($this->table);
    }


    /**
     * 修改
     * @auth true
     */
    public function state()
    {
        //$this->_checkInput();
        //SystemUser::mSave($this->_vali([
        //    'status.in:0,1' => '状态值范围异常！',
        //    'status.require' => '状态值不能为空！',
        //]));
    }

}